package com.none.usercenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.none.usercenter.mapper.FileMapper;
import com.none.usercenter.model.domain.File;
import com.none.usercenter.service.FileService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author xiaofeng
* @description 针对表【file(file)】的数据库操作Service实现
* @createDate 2025-10-23 19:30:20
*/
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File>
    implements FileService {

    @Resource
    private FileMapper fileMapper;
    @Override
    public boolean saveFile(String uuid, String fileSize, String fileName, String uploadName) {
        File file = new File();
        file.setUuid(uuid);
        file.setFileName(fileName);
        file.setFileSize(fileSize);
        file.setUploadName(uploadName);
        boolean save = this.save(file);
        return save;
    }

    @Override
    public List<File> getFileList(String uploadName) {
       // 查询用户是否存在
        QueryWrapper<File> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("upload_name", uploadName);
        List<File> files = fileMapper.selectList(queryWrapper);
        return files;
    }


}




